package com.example1.demo.controller;


import com.example1.demo.entity.TestEntity;
import com.example1.demo.service.TestService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by lorne on 2017/6/26.
 */
@Api(tags = "")
@RestController
@RequestMapping("/demo")
public class Demo1Controller {

    @Autowired
    private TestService testService;

    @ApiOperation("list")
    @RequestMapping("/list")
    @ResponseBody
    public List<TestEntity> list(){
        return testService.list();
    }

    @ApiOperation(value = "save")
    @RequestMapping("/save")
    @ResponseBody
    public int save(){
        return testService.save();
    }
}
